﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL
{
    using System.Data;
    using Entities;
   public  class ChucvuDAL:Base, Ibase
    {
        public ChucvuDAL()
        {
            
        }
        public ChucvuDAL(string strConnection)
            : base(strConnection)
        {
            
        }
        #region Ibase Members

        public int count()
        {
            throw new NotImplementedException();
        }

        public DataTable Select()
        {
            var sql = "SELECT * FROM CHUC_VU";
            return ExecuteQuery(sql);
        }

        public object Select(string id)
        {
            try
            {
                var sql = "SELECT * FROM CHUC_VU WHERE MA_CV = '{0}'";
                sql = String.Format(sql, id);
                var tmp = ExecuteQuery(sql);

                if (tmp != null & tmp.Rows.Count > 0)
                {
                    var dg = new Chucvu();
                    dg.MA_CV = tmp.Rows[0]["MA_CV"] + "";
                    dg.TEN_CV = tmp.Rows[0]["TEN_CV"] + "";
                   

                    return dg;
                }
                else return null;
            }
            catch { return null; }
        }

        public int Update(object obj)
        {
            throw new NotImplementedException();
        }

        public int Insert(object obj)
        {
            throw new NotImplementedException();
        }

        public int Delete(string id)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
